package cn.legend.travel.destination.main.controller;

import cn.legend.travel.common.pojo.po.SceneryPO;
import cn.legend.travel.common.web.JsonResult;
import cn.legend.travel.destination.main.pojo.vo.DelicacyVO;
import cn.legend.travel.destination.main.service.IDelicacyService;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/dict/delicacy")
@Validated
@Api(tags = "4.美食")
public class DelicacyController {
    @Autowired
    private IDelicacyService delicacyService;
    @GetMapping("/delicacyList")
    @ApiOperation("查询美食列表")
    @ApiOperationSupport(order = 420)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "目的地，默认为北京", required = true, dataType = "String", example = "北京")
    })
    public JsonResult selectScenery(@RequestParam String name) {
        log.info("开始处理【根据目的地名称查询美食列表】的请求，参数：{}", name);
        List<DelicacyVO> delicacyVOS = delicacyService.selectBydestinationName(name);
        return JsonResult.ok(delicacyVOS);
    }
}
